package org.example.test_qlexpress.function;

import com.ql.util.express.Operator;

public class DecodeFunction extends Operator {
    public Object executeInner(Object[] objects) throws Exception {
        if (objects == null || objects.length == 0) {
            throw new RuntimeException("未传入任何参数。");
        }
        if (objects.length < 4) {
            throw new RuntimeException("参数至少是4个。");
        }
        Object x1 = objects[0];
        Object x2 = objects[1];
        if (x1 == x2 || x1.equals(x2)) {
            return objects[2];
        }
        return objects[3];
    }
}
